//
//  cinemaTableViewCell.m
//  newDouban
//
//  Created by dllo on 15/10/17.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "cinemaTableViewCell.h"

@interface cinemaTableViewCell ()

@property (nonatomic, retain) UIImageView *backgroundImageV;
@property (nonatomic, retain) UILabel *titleL;
@property (nonatomic, retain) UILabel *addressL;
@property (nonatomic, retain) UILabel *phoneL;

@end

@implementation cinemaTableViewCell


- (void)dealloc
{
    [_backgroundImageV release];
    [_titleL release];
    [_addressL release];
    [_phoneL release];
    [super dealloc];
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    
    self.backgroundImageV = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 414 - 10, 220 - 20)];
    self.backgroundImageV.image = [UIImage imageNamed:@"bg_eventlistcell@2x.png"];
    [self.contentView addSubview:self.backgroundImageV];
    [_backgroundImageV release];
    
    self.titleL = [[UILabel alloc] initWithFrame:CGRectMake(self.backgroundImageV.frame.origin.x + 10, self.backgroundImageV.frame.origin.y + 5, self.backgroundImageV.frame.size.width - 20, 50)];
    //self.titleL.backgroundColor = [UIColor orangeColor];
    self.titleL.font = [UIFont boldSystemFontOfSize:25.0];
    [self.contentView addSubview:self.titleL];
    [_titleL release];
    
    
    self.addressL = [[UILabel alloc] initWithFrame:CGRectMake(self.backgroundImageV.frame.origin.x + 10, self.titleL.frame.origin.y + self.titleL.frame.size.height + 15, self.backgroundImageV.frame.size.width - 20, 70)];
    //self.addressL.backgroundColor = [UIColor orangeColor];
    self.addressL.numberOfLines = 0;
    //[self.addressL sizeToFit];在此不能用(不需要不合适)注意
    [self.contentView addSubview:self.addressL];
    [_addressL release];
    
    
    self.phoneL = [[UILabel alloc] initWithFrame:CGRectMake(self.backgroundImageV.frame.origin.x + 10, self.addressL.frame.origin.y + self.addressL.frame.size.height + 15, self.backgroundImageV.frame.size.width - 20, 30)];
    //self.phoneL.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.phoneL];
    [_phoneL release];
    
}


//- (void)layoutSubviews
//{
//    [super layoutSubviews];
//    self.titleL.text = @"北京博纳影城朝阳门旗舰店";
//    self.addressL.text = @"北京市朝阳区三丰北里2号楼悠唐生活广场B1层(朝阳门钱柜对面)";
//    self.phoneL.text = @"010 - 59775660";
//}


- (void)setCinema:(Cinema *)cinema
{
    if (_cinema != cinema) {
        [_cinema release];
        _cinema = [cinema retain];
    }
    
    self.titleL.text = cinema.cinemaName;
    self.addressL.text = cinema.address;
    self.phoneL.text = cinema.telephone;
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
